package com.ithappy.oop;

/*
* 测试super
* */

public class TestSuper01 {
    public static void main(String[] args) {
        ChildClass child1 = new ChildClass();
        child1.f();
    }
}

class FatherClass{
    public int value;
    public void f(){
        value = 100;
        System.out.println("FatherClass.value"+value);
    }
}

class ChildClass extends FatherClass{
    public int value;
    public int age;
    public void f(){
        super.f();  //调用父类的普通方法
        value = 200;
        // 父类也有value，子类也有value，但是在子类中的value优先调用自己的value，所以打印输出的为200
        System.out.println("ChildClass.value"+value);
        System.out.println(value);
        System.out.println(super.value);
    }
}
